package com.sqlcheck.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqlcheck.common.enums.DatabaseType;
import com.sqlcheck.dto.request.CreateCompatibilityRuleRequest;
import com.sqlcheck.dto.request.UpdateCompatibilityRuleRequest;
import com.sqlcheck.dto.response.CompatibilityRuleResponse;
import com.sqlcheck.entity.CompatibilityRule;

import java.util.List;

public interface CompatibilityRuleService {

    /**
     * 分页获取兼容性规则
     */
    IPage<CompatibilityRuleResponse> getRules(Page<CompatibilityRuleResponse> page,
            String sourceDbType, String targetDbType, String severity, String category, String search);

    /**
     * 根据ID获取规则详情
     */
    CompatibilityRuleResponse getRuleById(Long ruleId);

    /**
     * 根据规则编号获取规则详情
     */
    CompatibilityRuleResponse getRuleByRuleId(String ruleId);

    /**
     * 创建新的兼容性规则
     */
    CompatibilityRuleResponse createRule(CreateCompatibilityRuleRequest request);

    /**
     * 更新兼容性规则
     */
    CompatibilityRuleResponse updateRule(Long ruleId, UpdateCompatibilityRuleRequest request);

    /**
     * 切换规则启用/禁用状态
     */
    CompatibilityRuleResponse toggleRuleStatus(Long ruleId);

    /**
     * 删除规则（软删除）
     */
    void deleteRule(Long ruleId);

    /**
     * 批量更新规则状态
     */
    void batchUpdateRuleStatus(List<Long> ruleIds, Boolean isActive);

    /**
     * 获取用于LLM优化的兼容性规则
     */
    List<CompatibilityRule> getRulesForLLMOptimization(DatabaseType sourceDbType, DatabaseType targetDbType);
}
